package com.eascs.p2p.admin.manager.impl;


import java.util.Date;
import java.util.List;

import org.springframework.stereotype.Repository;

import com.eascs.app.log.Logger;
import com.eascs.app.log.LoggerFactory;
import com.eascs.common.util.DateUtils;
import com.eascs.p2p.admin.manager.IInvestorIncomeDetailManager;
import com.eascs.p2p.common.dao.BaseDao;
import com.eascs.p2p.common.entity.InvestorIncomeDetailEntity;
import com.eascs.p2p.common.vo.RepaymentVO;





@Repository
public class InvestorIncomeDetailManagerImpl extends BaseDao implements IInvestorIncomeDetailManager {
	private Logger logger = LoggerFactory.getLogger(this.getClass());

	@Override
	public boolean add(InvestorIncomeDetailEntity entity) {
		
		return this.insert(entity);
	}

	@Override
	public boolean update(String object_id,int issue) {
		String date=DateUtils.formateStandDateTime(new Date());
		String sql="update p2p_investor_income_detail set actual_receive_time=? , status=1 where object_id=? and issue=?" ;
		return this.execute(sql,date,object_id,issue);
	}

	@Override
	public List<RepaymentVO> getInvestorIncome(String bid_id, int num) {
		String sql="select invest_id as investorId ,principal,income from p2p_investor_income_detail where object_id=? and issue=? and status=0" ;
		return this.findEntitys(sql, RepaymentVO.class, bid_id,num);
	}

	







}
